<div class="pad_t15">
<div class="pad_b15">
<?php if($ctx->photo_description!="") { ?>
<p><label>Description: </label><?php echo $ctx->photo_description; ?></p>
<? } else { ?>
<?php if($ctx->addedby == $_SESSION['sess_userid']) { ?>
<a class="Button" href="javascript:void(0);" onclick="showTextArea();"><span>Add Description</span></a>
<? }?>
<div class="clear"></div>
<div id="div1">
</div>
<? } ?>
<div class="clear"></div>
</div>
<?php if($ctx->is_owner != '1') { ?>
<p class="pad_b15"><a href="#" class="UserComment">Comments(<?php echo $ctx->getComments['resultsCount'];?>)</a></p>

<?php if($ctx->comments_allow=="Y" || $ctx->addedby == $_SESSION['sess_userid']){ ?>
<div class="TrgComInput" style="background:#c4ebff;">
<div class="blkCont">
<p class="UserImg"><img src="/Uploads/users/<?php echo $_SESSION['sess_photo']; ?>" height="50px" width="50px" /></p>
</div>
<div class="blkCont">
<div class="wid278">
<input type="text" id="comment" name="comment" value="" class="TextFile" onChange="submitComment(this,<?php echo $ctx->photo_id; ?>);" />

</div>
</div>
<div class="clear"></div>
</div>
<? } ?>
<?php if(is_array($ctx->getComments['result']) && count($ctx->getComments['result'])>0) { ?>
<tal:block tal:repeat="comments  getComments/result">
<div class="TrgCom ">
<div class="blkCont">
<p class="UserImg"><img src="/Uploads/users/<?php echo $ctx->comments['photo']; ?>" height="45" width="45" alt="Album" title="User photo" /></p>
</div>
<div class="blkCont">
<div class="wid278">
<p class="UName"><a href="#"><?php echo $ctx->comments['first_name']; ?></a></p>
<p class="Desc"><?php echo $ctx->comments['comment']; ?></p>
<p class="Date"><?php echo ago(strtotime($ctx->comments['added_date'])) ?></p>

</div>
</div>
<div class="Fright">
<?php if($ctx->comments['user_id']==$_SESSION["sess_userid"] || $ctx->comments['owner_id']==$_SESSION["sess_userid"]) {  ?>
<span><a href="javascript:void(0);" onclick="deleteComment(<?php echo $ctx->comments['id']?>,'<?php echo $ctx->photo_id?>');"><img src="/images/CloseIcon.png" alt="Close" border="0" class="img_inline" title="Delete"/></a></span>
<?php } ?>
</div>
</div>
</tal:block>
<div class="clear"></div>
 <div id="downPagerId" class="paginat" style="padding-right:15px;"></div>
 <div class="clear"></div>
<? } else { ?>
<p style="padding:20px 50px"><b><center><h3>No Comments </h3></center></b></p>
<? } ?>
<? }?>
</div>
<script>
//<![CDATA[
function showTextArea()
{
	//alert(obj.value);return false;
	document.getElementById('div1').innerHTML = '<div class="pad_t15"><textarea id="description" name="description"></textarea><p><a class="Button" href="javascript:void(0);" onclick="addPhotoDescription(<?php echo $ctx->photo_id; ?>,<?php echo $ctx->is_owner ?>);"><span>Add</span></a></p></div>'

}

//]]>
</script>
<script type="text/javascript">
//<![CDATA[
	pagination = new Array();
	pagination['currentPage'] = "<?=$ctx->getComments['currentPage']?>";
	pagination['resultsPerPage'] = "<?=$ctx->getComments['resultPerPage']?>";
	pagination['pages'] = "<?= $ctx->getComments['pages']?>";  
	pagination['pager'] = '<?=$ctx->getComments["pager"]?>';
	pagination['resultsCount'] = "${getComments/resultsCount}" ;
	
	var Params='${params}';
	//alert(pagination['resultsCount']+'  '+Params);
	var requestUrl = "/album/index/pagination/<?php echo $ctx->photo_id; ?>/";
	$(document).ready(function () {
	   setPagination(pagination['resultsCount'],'','downPagerId','','');
	});


//]]>
</script>
